#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <sys/types.h>
#include <sys/timeb.h>
#include <string.h>
#include <assert.h>
#include <malloc.h>
#include <conio.h>
#include <locale.h>
#include <crtdbg.h>
#include <direct.h>
#include <io.h>
#include <ctype.h>


/*******************************************
@describe : standard lib
@author : xiaozhi 
@Copyright : copyright (c)  xiaozhi 2006 wise
@date : 06.3.2   10:28
*******************************************/

typedef struct Link 
{
	int data;
	struct *next;
}link;

link *create(link *hea)
{
	int c;
	link *head, *s, *r=0;
	head = (link*)malloc(sizeof(link));
	scanf("%d", &c);
	while(c != -1)
	{
		s = (link*)malloc(sizeof(link));
		s->data = c;
		r->next = s->next;
		r = s;
		scanf("%d", &c);
	}
	r ->next = '\0';
	return head;
}

void print_link(link *head)
{
	link *p =0;
	p->next = head->next;

	if(p == '\0')
		printf("Link list is NULL!\n");
	else
	{
		printf("head\n");
		do
		{
			printf("------>%d\n", p->data);
			p->next = p ->next;
		}
		while(p != '\0');
		printf("---->end\n");
	}
}

void delete_link (link *head, int x)
{ 
	link *p, *q;
	q = head;
	p = head;
	while((p != '\0') && (head->data != x))
	{
		q = p;
		p->next = p->next;
	}
	if(p == '\0')
		printf("Cannot delete!");
	else
	{
		q->next = p ->next;
		free(p);
	}
}

void main(void)
{
	link *head=0;
	create(head);
	print_link(head);
}